public class libstr
{
    /// <summary>
	/// Pick up the text in <msg> from <strsta> to <strend>.
	/// </summary>
	/// <param name="msg">Orginal text.</param>
	/// <param name="strsta">Start pattern of the result text.</param>
	/// <param name="strend">End pattern of the result text.</param>
	public static string strsel (string msg, string strsta, string strend)
	{
		int p1 = 0;
		int p2 = msg.Length;
		int l1 = strsta.Length;
		int l2 = strend.Length;
		if (l1 != 0)
		{
			p1 = msg.IndexOf (strsta);
			if (p1 == -1)
				return "";
		}
		l2 = strend.Length;
		if (l2 != 0)
		{
			p2 = msg.IndexOf (strend, p1);
			if (p2 == -1)
				return "";
		}
		msg = msg.Substring (p1, p2 - p1);
		return msg;
	}
}
